<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="page-header">
	<h3 style="margin-top: auto">用户个人信息</h3>
</div>
<div class="row-fluid">
	<div>
		<table class="table table-hover" style="width: 60%">
			<thead>
				<tr>
					<th style="width: 15%">属性</th>
					<th style="width: 85%">详细信息
					<button class="btn btn-small" style="float:right"
						onclick="window.location.href='<%=request.getContextPath()%>/user/${user.id}/update';">
							<i class="icon-edit"></i>&nbsp;修改个人信息</button></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>用户名</td>
					<td><c:out value="${user.username}" /></td>
				</tr>
				<tr>
					<td>密码</td>
					<td>
						<c:if test="${flag == 1}">
							<button class="btn"
								onclick="window.location.href='<%=request.getContextPath()%>/user/update/password';">
								<i class="icon-edit"></i>&nbsp;修改密码
							</button>
						</c:if>
						<button class="btn" id="modal-586231" href="#modal-container-reset-password" role="button"
							class="btn" data-toggle="modal">
							<i class="icon-edit"></i>&nbsp;重置密码
						</button>
						</td>
				</tr>
				<tr>
					<td>真实姓名</td>
					<td><c:out value="${user.realname}" /></td>
				</tr>
				<tr>
					<td>工号</td>
					<td><c:out value="${user.staffNum}" /></td>
				</tr>
				<tr>
					<td>email</td>
					<td><c:out value="${user.email}" /></td>
				</tr>
				<tr>
					<td>权限</td>
					<td><c:choose>
							<c:when test="${!empty user.groupsList}">
								<c:forEach items="${user.groupsList}" var="list" varStatus="s">
									<c:out value="${list.value}" />
											&nbsp;
								</c:forEach>
							</c:when>
						</c:choose>
						<shiro:hasRole name="Admin">
						<br />
						<a id="modal-586231" href="#modal-container-586231" role="button"
							class="btn" data-toggle="modal" style="margin-top:5px"><i class="icon-edit"></i>&nbsp;更改权限</a>
						</shiro:hasRole>
						</td>
				</tr>
			</tbody>
			<tfoot>
			</tfoot>
		</table>
	</div>
</div>
<div id="modal-container-586231" class="modal hide fade" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="false" style="width:500px">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal"
			aria-hidden="true">×</button>
		<h3 id="myModalLabel">更改权限</h3>
	</div>
	<div class="modal-body">
		<form class="form-horizontal"
			action="<%=request.getContextPath()%>/user/${user.id}/group/add"
			method="POST" onsubmit="return valid()" style="margin-left:25px">
			<div class="control-group">
				<label>请选择赋予该用户的角色：</label>
				<!-- <input type='checkbox' name='ids' value="admin">系统管理员</input><br />
				<input type='checkbox' name='ids' value="Architector">架构师</input><br />
				<input type='checkbox' name='ids' value="Designer">设计师</input><br />
				<input type='checkbox' name='ids' value="DomainExpert">领域专家</input><br />
				<input type='checkbox' name='ids' value="Programmer">软件开发人员</input> -->
				<c:forEach var="group" items="${groupsList}">
					<div style="margin-bottom:5px" >
					<input type='checkbox' name='ids' value="${group.id}" >&nbsp;&nbsp;<c:out value="${group.value}" /></input><br />
					</div>
				</c:forEach>
				<span class="help-inline" id="help_group"></span>
			</div>
			<div class="control-group">
				<div class="controls">
				<button class="btn" data-dismiss="modal" aria-hidden="true" style="float:right;margin-left:20px">关闭</button>
					<input type="submit" class="btn" value="提交" style="float:right;margin-left:20px"/>
				</div>
			</div>
		</form>
	</div>
</div>
<div id="modal-container-reset-password" class="modal hide fade" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="false">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal"
			aria-hidden="true">×</button>
		<h3 id="myModalLabel">重置密码</h3>
	</div>
	<div class="modal-body">
		<p>确定要重置该用户的密码为初始密码：111111吗？</p>
	</div>
	<div class="modal-footer">
		<button class="btn" data-dismiss="modal" aria-hidden="true">
			<i class="icon-remove"></i>&nbsp;关闭
		</button>
		<button class="btn" onclick="window.location.href='<%=request.getContextPath()%>/user/${user.id}/reset/password';">
			<i class="icon-ok"></i>&nbsp;确定
		</button>
	</div>
</div>